//
//  TMGGoldAssetViewController.m
//  TMGold
//
//  Created by Mac on 2017/12/12.
//  Copyright © 2017年 tangmu. All rights reserved.
//

#import "TMGAccountViewController.h"
#import "TMGRechageViewController.h"
#import "TMGMakeMoneyViewController.h"
@interface TMGAccountViewController ()

@end

@implementation TMGAccountViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"账号余额";
    [self configSubView];
    [self configBottomView];
    self.view.backgroundColor = [UIColor whiteColor];
    // Do any additional setup after loading the view.
}

#pragma mark --subView
- (void)configSubView{
    UIView * header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 100)];
    header.backgroundColor = [UIColor clearColor];
    
    
    STLabel * titleLable = [[STLabel alloc] initWithFrame:CGRectMake(15, 10, 200, 50)
                                                     text:@"账户余额(元)"
                                                textColor:FirstTextColor
                                                     font:15
                                              isSizetoFit:NO
                                            textAlignment:NSTextAlignmentLeft];
    titleLable.backgroundColor = [UIColor clearColor];
    [header addSubview:titleLable];
    
   
    STLabel * moneyLable = [[STLabel alloc] initWithFrame:CGRectMake(0, titleLable.bottom, UIScreenWidth, 80)
                                                     text:self.money
                                                textColor:TM_orangeColor
                                                     font:20
                                              isSizetoFit:NO
                                            textAlignment:NSTextAlignmentCenter];
    moneyLable.backgroundColor = [UIColor whiteColor];
    [header addSubview:moneyLable];
    
    
    STLabel * desLable = [[STLabel alloc] initWithFrame:CGRectMake(15, 10, 100, 20)
                                                     text:@"我的余额"
                                                textColor:FirstTextColor
                                                     font:15
                                              isSizetoFit:NO
                                            textAlignment:NSTextAlignmentLeft];
    [moneyLable addSubview:desLable];
    
    header.height = moneyLable.bottom;
    self.tableView.tableHeaderView = header;
    
    
}
- (void)configBottomView{
    UIView * bootomView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 49)];
    bootomView.top = [TMUtils tabBarTop];
    [bootomView st_showTopShadow];
    [self.view addSubview:bootomView];
    
    __weak typeof(self) weakSelf =  self;
    self.tableView.height = self.tableView.height - 44;
    STButton * outButton = [[STButton alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth/2, 49)
                                                     title:@"提现"
                                                titleColor:TM_orangeColor
                                                 titleFont:16
                                              cornerRadius:0
                                           backgroundColor:[UIColor whiteColor]
                                           backgroundImage:nil
                                                     image:nil];
    outButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    [outButton st_showRightLine:outButton.height];
    [outButton setClicAction:^(UIButton *sender) {
        [weakSelf onSlectedTixianButton];
    }];
    [bootomView addSubview:outButton];
    
    STButton * tijintButton = [[STButton alloc] initWithFrame:CGRectMake(outButton.right, 0, UIScreenWidth/2, 49)
                                                        title:@"充值"
                                                   titleColor:FlatWhite
                                                    titleFont:16
                                                 cornerRadius:0
                                              backgroundColor:TM_orangeColor
                                              backgroundImage:nil
                                                        image:nil];
    tijintButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    [tijintButton setClicAction:^(UIButton *sender) {
        [weakSelf onSlectedChongzhiButton];
    }];
    [bootomView addSubview:tijintButton];
}

#pragma mark --Action Method
- (void)onSlectedTixianButton{
    TMGMakeMoneyViewController * vc = [TMGMakeMoneyViewController new];
    vc.money = self.money;
    [self.navigationController pushViewController:vc animated:YES];
}
- (void)onSlectedChongzhiButton{
  [self.navigationController pushViewController:[TMGRechageViewController new] animated:YES];
}

@end

